#pragma once

class ILog;
extern ILog* g_Log;

#define __CondInfo(condition, format, ...)		if (condition) {g_Log->Log(__FILE__, __LINE__, __FUNCTION__, #condition, 0, format, __VA_ARGS__);}
#define __CondWarning(condition, format, ...)	if (condition) {g_Log->Log(__FILE__, __LINE__, __FUNCTION__, #condition, 1, format, __VA_ARGS__);}
#define __CondError(condition, format, ...)		if (condition) {g_Log->Log(__FILE__, __LINE__, __FUNCTION__, #condition, 2, format, __VA_ARGS__);}

#define __Info(format, ...)						{g_Log->Log(__FILE__, __LINE__, __FUNCTION__, "", 0, format, __VA_ARGS__);}
#define __Warning(format, ...)					{g_Log->Log(__FILE__, __LINE__, __FUNCTION__, "", 1, format, __VA_ARGS__);}
#define __Error(format, ...)					{g_Log->Log(__FILE__, __LINE__, __FUNCTION__, "", 2, format, __VA_ARGS__);}

#define __Check(condition)						if (!(condition)) {g_Log->Log(__FILE__, __LINE__, __FUNCTION__, #condition, 3, "ASSERT FAILED: %s", #condition);}
#define __Crash(format, ...)					{g_Log->Log(__FILE__, __LINE__, __FUNCTION__, "", 3, format, __VA_ARGS__);}


/*--------------------------------------------------------------------------*/

class ILog
{
public:
	ILog();
	~ILog();

	virtual void		Log(const char* file, int line, const char* func, const char* code, int priority, const char* format, ...) = 0;

	static void			CreateInstance();
	static void			DestroyInstance();
};

